package com.itgungnir.designpattern.proxy.dynamicproxy;

import java.lang.reflect.Proxy;

public class Test {
	public static void main(String[] args) {
		Car car = new Car();
		Class<?> carClass = car.getClass();
		TimeInvocationHandler timeHandler = new TimeInvocationHandler(car);
		/**
		 * loader：被代理类的类加载器<br/>
		 * interfaces：被代理类实现的接口<br/>
		 * h：InvocationHandler
		 */
		Vehicle v = (Vehicle) Proxy.newProxyInstance(carClass.getClassLoader(), carClass.getInterfaces(), timeHandler);
		v.move();
	}
}